$(function() {
	validateFrom();
});

function validateFrom() {
	//location.href="../../manager_userbasic/validateName";
	var b = {
		pmNamespace : function() {
			return $("#pmNamespace").val();
		}
	};
	var c = GetRemoteInfo("../../manager_permissionmenu/validatenamespace", b);

	var d = {
		pmName : function() {
			return $("#pmName").val();
		}

	};

	var e = GetRemoteInfo("../../manager_permissionmenu/validatename", d);

	$("#addForm").validate({
		rules : {
			pmName : {
				required : true,
				remote : e
			},
			pmNamespace : {
				required : true,
				remote : c
			}
		},
		messages : {
			pmName : {
				required : "请输入菜单名称。",
				remote : "已存在此名称，请检查后重新输入。"
			},
			pmNamespace : {
				required : "请输入NameSpace。",
				remote : "已存在此名称，请检查后重新输入。"
			}
		},
		success : function(a) {
			a.html("&nbsp;").attr("class", "success").siblings("i").remove();
		},
		errorPlacement : function(b, a) {
			$(a).next("i").find(".success").remove();
			b.appendTo(a.next("i"));
		}
	});
}